﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Stamp_For_Africa_Version_2.Models;
using Stamp_For_Africa_Version_2.Repositories;

namespace Stamp_For_Africa_Version_2.ViewModels
{
  public class ManageStampViewModel
  {
    public Stamp Stamp { get; set; }
    public Guid StampId { get; set; }
    public Guid SelectedCatalogueId { get; set; }
    public int CatalogueNumber { get; set; }

		public List<CatalogueEntry> AssignedCatalogues { get; set; }
		public SelectList AvailableCatalogues 
		{ 
			get
			{
        CatalogueRepository repository = new CatalogueRepository();				
				List<Guid> asscats = AssignedCatalogues.Select(u => u.CatalogueId).ToList();
				return new SelectList(repository.FindAllCatalogues().Where(u => !asscats.Contains(u.Id)), "Id", "CatalogName", Stamp.CatalogueId);
         
			}
		}

		public List<Stamp> GetStampVariations
		{
			get
			{
				StampRepository stampRepository = new StampRepository();
				return stampRepository.GetLinkedStamps(Stamp.Id, LinkType.Variation);
			}
		}

		public List<Variation> StampVariants { get; set; }
		public Variation NewVariation { get; set; }
  }
}